import React from 'react'
import { Select } from 'antd'

const { Option } = Select



export default function MySelect({ list, title, type, name }) {
    const handleChange = (value) => {
        sessionStorage.setItem(type, value)
    }
    return (
        <div>
            <p>请选择{ title }：</p>
            <Select style={{ width: 120 }} onChange={handleChange}>
                {
                    list.map(item => {
                        return <Option key={item[type]}
                            value={item[type]}>
                            {item[name]}
                        </Option>
                    })
                }
            </Select>
        </div>
    )
}
